# Maintainer: Campbell Jones <arch at serebit dot com>
# Contributor: Sandy Carter <bwrsandman at gmail dot com>
# Contributor: Hans-Kristian Arntzen <post at arntzen-software dot no>
# Contributor: Joshua Ashton <joshua at froggi dot es>

pkgname=renderdoc
pkgver=1.29
pkgrel=1
pkgdesc="OpenGL and Vulkan debugging tool"
arch=(loong64 x86_64)
url="https://github.com/baldurk/renderdoc"
license=("MIT")
makedepends=("cmake" "pcre" "python" "ninja")
depends=("libgl" "libx11" "libxcb" "mesa" "qt5-base" "qt5-svg" "qt5-x11extras" "xcb-util-keysyms")
options=("!lto")
source=("https://github.com/baldurk/$pkgname/archive/v${pkgver}.tar.gz"
        "https://github.com/baldurk/$pkgname/releases/download/v${pkgver}/v${pkgver}.tar.gz.asc"
        "https://github.com/baldurk/swig/archive/${pkgname}-modified-7.zip")
validpgpkeys=('1B039DB9A4718A2D699DE031AC612C3120C34695')
b2sums=('492b32140c8ad1ab3e753158cfede64ea0b580a2df03094aeeff2d4eac659fbedc62971f65d3fe024e0282de39d5f122b512be2fc6a28ac7abf794b58f116322'
        'SKIP'
        '136b0b48d5bddb2dfe6fffd54220a5b62bb9a725b800f1f7846d03469f0c859d0585a61118f64b2def81ad94ff650bdf82d1db7aeb7608a190792ce8033597dc')

build() {
    cmake -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DBUILD_VERSION_STABLE=ON \
        -DBUILD_VERSION_DIST_CONTACT="https://archlinux.org/packages/$pkgname" \
        -DBUILD_VERSION_DIST_NAME="Arch" \
        -DBUILD_VERSION_DIST_VER="$pkgver" \
        -DRENDERDOC_SWIG_PACKAGE="$srcdir/${pkgname}-modified-7.zip" \
        -DVULKAN_LAYER_FOLDER="/etc/vulkan/implicit_layer.d" \
        -B"${pkgname}-$pkgver"/build \
        -H"${pkgname}-$pkgver"
    cmake --build "${pkgname}-$pkgver"/build
}

package() {
    DESTDIR="$pkgdir" cmake --install "${pkgname}-$pkgver"/build
    install -Dm644 "${pkgname}-$pkgver/LICENSE.md" "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}
